﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Kassasysteem_TacoTruijens
{
    public partial class printtickets : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            initTableTickets();
        }

        private void initTableTickets()
        {
            String movieName = Request.QueryString["moviename"];
            String[] tickets = Request.QueryString["tickets"].Split(';');

            foreach (String t in tickets)
            {
                String[] ticket = t.Split(':');

                TableRow tableRow = new TableRow();
                TableCell tableCell = new TableCell();

                tableCell.Text = "<h5>Ticket " + movieName + "</h5><b>Nummer:</b> " + ticket[0] + ", <b>Type:</b> " + ticket[1] + ", <b>rij:</b> " + ticket[3] + " <b>stoel:</b> " + ticket[2];
                tableRow.Controls.Add(tableCell);
                tableTickets.Controls.Add(tableRow);
            }

            TableRow tableRowPrint = new TableRow();
            TableCell tableCellPrint = new TableCell();
            tableCellPrint.CssClass = "alignRight";

            tableCellPrint.Text = "<br /><input type='button' onclick='window.print()' value='Printen' />";
            tableRowPrint.Controls.Add(tableCellPrint);
            tableTickets.Controls.Add(tableRowPrint);
        }
    }
}